#include<iostream>

using namespace std;

int main(){
	int num = 0;
	int maxTime = 0;
	for(int i = 1; i <= 7; i++){
		int a;
		int b;
		int sum;
		cin >> a >> b;
		sum = a + b;
		if(sum <= 8) continue;
		else{
			if(sum > maxTime){
				num = i;
				maxTime = sum;
			}
		}
	}
	cout << num << endl;
	return 0;
}
